package org.example.myleet.rosalind.dbru;

import org.example.myleet.rosalind.utils.DnaReverseComplementor;

import java.io.*;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

public class Solution {
    public static void main(String[] args) throws IOException {
        Solution solution = new Solution();
        String path = solution.getClass().getResource("").getPath() + "example.txt";
        BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(path)));
        List<String> reads = new ArrayList<>(1000);
        String line;
        while (null != (line = br.readLine())) {
            if (line.length() < 1) {
                break;
            }
            reads.add(line);
        }
        Set<String> readSet = new HashSet<>(reads);
        Set<String> rcReadSet = new HashSet<>(reads.size());
        for (String read : readSet) {
            rcReadSet.add(DnaReverseComplementor.reverseComplete(read));
        }
        readSet.addAll(rcReadSet);
        for (String read : readSet) {
            System.out.printf("(%s, %s)\n", read.substring(0, read.length() - 1), read.substring(1));
        }
        br.close();
    }
}
